home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / tpapi.exe / EXAMPLES / BINDLIST.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-14  |  3KB  |  103 lines

  1. {***************************************************************************}
  2. {** Program : BLIST.PAS                                                   **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started :           ** Ended :           **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** BLIST will simply list all the objects in the bindery of a specified  **}
  9. {** type.                                                                 **}
  10. {**                                                                       **}
  11. {**                                                                       **}
  12. {**                                                                       **}
  13. {***************************************************************************}
  14. {******************************** Information ******************************}
  15. {***************************************************************************}
  16. {** USAGE :                                                               **}
  17. {**                                                                       **}
  18. {**   BLIST SearchSpec BinderyObjectType                                  **}
  19. {**                                                                       **}
  20. {**                                                                       **}
  21. {***************************************************************************}
  22.  
  23. program BLIST;
  24.  
  25. USES
  26.  
  27.   nwvar,
  28.   nwerror,
  29.   nwbindry;
  30.  
  31. VAR
  32.  
  33.   BinderyServices : BinderyOBJ;
  34.   CommandLine     : STRING;
  35.   BObjectType     : OT_BinderyType;
  36.   BSearchSpec     : TObjectName;
  37.  
  38.  
  39. procedure GetCommandLine;
  40.  
  41. BEGIN
  42.  
  43.   if paramcount < 2 then
  44.     begin
  45.  
  46.       writeln;
  47.       writeln ('You must supply two parameters :');
  48.       writeln;
  49.       writeln ('BINDLIST <searchspec> <ObjectType>');
  50.       writeln;
  51.       writeln ('Examples : Users        = 1');
  52.       writeln ('         : Groups       = 2');
  53.       writeln ('         : PrintQueues  = 3');
  54.       writeln ('         : FileServers  = 4');
  55.       writeln ('         : PrintServers = 7');
  56.  
  57.       halt;
  58.  
  59.     end;
  60.  
  61.   BSearchSpec := BinderyServices.UppercaseNW (PARAMSTR (1));
  62.   BObjectType := BinderyServices.StrToInt (paramstr (2));
  63.  
  64. END; {GetCommandLine}
  65.  
  66. {***}
  67.  
  68. procedure DisplayBinderyObjects;
  69.  
  70. VAR
  71.  
  72.   ObjectID    : OT_BinderyID;
  73.   ObjectName  : TObjectName;
  74.   ObjectType  : OT_BinderyType;
  75.   ObjectHasProperty,
  76.   ObjectFlags,
  77.   ObjectSecurity    : BYTE;
  78.  
  79. BEGIN
  80.  
  81.   ObjectID := - 1;
  82.   WITH BinderyServices DO
  83.     WHILE ScanBinderyObject (BSearchSpec, BObjectType, ObjectID, ObjectName,
  84.                              ObjectType, ObjectHasProperty, ObjectFlags, ObjectSecurity) = SUCCESSFUL DO
  85.  
  86.       WRITELN (ObjectName, HexString (ObjectHasProperty, 2) : 50 - LENGTH (ObjectName), 'h  ',
  87.                HexString (ObjectFlags, 2), 'h  ', HexString (ObjectSecurity, 2), 'h');
  88.  
  89. END; {DisplayBinderyObjects}
  90.  
  91. {***}
  92.  
  93. BEGIN
  94.  
  95.   BinderyServices.Init (false);
  96.   GetCommandLine;
  97.   DisplayBinderyObjects;
  98.   BinderyServices.Done;
  99.  
  100. END.
  101.  
  102.  
  103.